// 接口导入
import instance from '../utils/request'
// 导入工具函数
// import { getToken } from '../utils/token'

// 接口文章抽取
const gitArticle = ({ id }) => {
  return instance({
    url: '/v1_0/articles/' + id,
    method: 'get'
  })
}
// 抽取api 关注用户
const followUser = ({ target }) => {
  return instance({
    url: '/v1_0/user/followings',
    method: 'post',
    data: {
      target
    }
  })
}
// 抽取api 取关用户
const unFollowUser = ({ target }) => {
  return instance({
    url: '/v1_0/user/followings/' + target,
    method: 'delete'
  })
}

// 抽取api 点赞用户
const zanUser = ({ target }) => {
  return instance({
    url: '/v1_0/article/likings',
    method: 'post',
    data: {
      target
    }
  })
}
// 抽取api 取消点赞用户
const unZanUser = ({ target }) => {
  return instance({
    url: '/v1_0/article/likings/' + target,
    method: 'delete'
  })
}

// 抽取api 喜欢用户
const likeUser = ({ target }) => {
  return instance({
    url: '/v1_0/article/dislikes',
    method: 'post',
    data: {
      target
    }
  })
}
// 抽取api 取消喜欢用户
const unLikeUser = ({ target }) => {
  return instance({
    url: '/v1_0/article/dislikes/' + target,
    method: 'delete'
  })
}
// 暴露出去
export {
  gitArticle,
  followUser,
  unFollowUser,
  zanUser,
  unZanUser,
  likeUser,
  unLikeUser
}
